package com.nexttwist.util;

import java.io.IOException;
import java.io.InputStream;

import android.content.Context;
import android.content.res.AssetManager;

public class Util {
	AssetManager assetManager;
	
	public void setContext(Context myContext) {
        	assetManager = myContext.getAssets();
    }

	public String loadJSONFromAsset(String fileName) {
	    String json = null;
	    try {

	        InputStream is = assetManager.open(fileName);

	        int size = is.available();

	        byte[] buffer = new byte[size];

	        is.read(buffer);

	        is.close();

	        json = new String(buffer, "UTF-8");


	    } catch (IOException ex) {
	        ex.printStackTrace();
	        return null;
	    }
	    return json;

	}
}
